package main

import (
	"communication-system/client/process"
	"fmt"
)

var userId int
var userPwd string
var userName string

func main() {
	var key int
	//var loop = true

	for {
		fmt.Println("--------------------Welcome login ChatRoom------------------------")
		fmt.Println("\t\t\t 1. login")
		fmt.Println("\t\t\t 2. sign in")
		fmt.Println("\t\t\t 3. exit")
		fmt.Println("\t\t\t Please choose(1-3):")

		fmt.Scanf("%d\n", &key)
		switch key {
		case 1:
			fmt.Println("login")
			fmt.Println("Please input userid:")
			fmt.Scanf("%d\n", &userId)
			fmt.Println("Please input userpwd:")
			fmt.Scanf("%s\n", &userPwd)

			up := &process.UserProcess{}
			up.Login(userId, userPwd)

		case 2:
			fmt.Println("sign in")
			fmt.Println("Please input userid:")
			fmt.Scanf("%d\n", &userId)
			fmt.Println("Please input userpwd:")
			fmt.Scanf("%s\n", &userPwd)
			fmt.Println("Please input username:")
			fmt.Scanf("%s\n", &userName)
			up := &process.UserProcess{}
			up.Register(userId, userPwd, userName)

		case 3:
			fmt.Println("exit")
			//loop = false
		default:
			fmt.Println("input error, please input again")
		}
	}

	return
}
